<?php
/**
 * 头部菜单
 * User: adophper <hello@adophper.com>
 * Date: 2018/3/22
 * Time: 11:43
 */
namespace frontend\widgets;
use common\services\FrontendMenuServices;
use yii\bootstrap\Widget;

class HeaderMenu extends Widget {

    private $view = '@frontend/views/widget/header-menu.php';

    public $params = [];

    public function init()
    {
        $menuService = new FrontendMenuServices();
        $headerMenu = $menuService->getMenu('head');
        $this->params['menu'] = $headerMenu;
    }

    public function run()
    {
        echo $this->renderFile($this->view, $this->params);
    }
}